using System.Data.Entity.ModelConfiguration;
using Turquoise.Entities.Data;

namespace Turquoise.DataAccess.EntityFramework.Mappings
{

    public class ContentTypeLanguageLineMapping : EntityTypeConfiguration<ContentTypeLanguageLine>
    {
        public ContentTypeLanguageLineMapping(string schema = "dbo")
        {
            ToTable(schema + ".ContentTypeLanguageLine");
            HasKey(x => x.Id);

            Property(x => x.Id).HasColumnName("Id").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
            Property(x => x.ContentTypeId).HasColumnName("ContentTypeId").IsRequired().HasColumnType("int");
            Property(x => x.LanguageId).HasColumnName("LanguageId").IsRequired().HasColumnType("int");
            Property(x => x.ContentTypeName).HasColumnName("ContentTypeName").IsRequired().HasColumnType("nvarchar").HasMaxLength(255);
            Property(x => x.ContentTypeDescription).HasColumnName("ContentTypeDescription").IsOptional().HasColumnType("nvarchar").HasMaxLength(500);
            Property(x => x.CreateDate).HasColumnName("CreateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.CreatedBy).HasColumnName("CreatedBy").IsRequired().HasColumnType("int");
            Property(x => x.UpdateDate).HasColumnName("UpdateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.UpdatedBy).HasColumnName("UpdatedBy").IsRequired().HasColumnType("int");
            Property(x => x.DisplayOrder).HasColumnName("DisplayOrder").IsRequired().HasColumnType("int");
            Property(x => x.IsApproved).HasColumnName("IsApproved").IsRequired().HasColumnType("bit");
            HasRequired(t => t.ContentType).WithMany(t => t.ContentTypeLanguageLines).HasForeignKey(x => x.ContentTypeId);
            HasRequired(t => t.Language).WithMany(t => t.ContentTypeLanguageLines).HasForeignKey(x => x.LanguageId);
            HasRequired(t => t.User_CreatedBy).WithMany(t => t.ContentTypeLanguageLines_CreatedBy).HasForeignKey(x => x.CreatedBy);
            HasRequired(t => t.User_UpdatedBy).WithMany(t => t.ContentTypeLanguageLines_UpdatedBy).HasForeignKey(x => x.UpdatedBy);
        }
    }

}

